﻿<UserControl
    x:Class="DvachBrowser3.Views.Partial.BoardTile"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:DvachBrowser3.Views.Partial"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:inter="using:Microsoft.Xaml.Interactivity"
    xmlns:core="using:Microsoft.Xaml.Interactions.Core"
    mc:Ignorable="d"
    d:DesignHeight="75"
    d:DesignWidth="175">
    
    <UserControl.Resources>
        <local:BoardTileShortNameConverter x:Key="ShortNameConverter" />
    </UserControl.Resources>
          
    <Border Width="{x:Bind ViewModel.StyleManager.Tiles.BoardTileWidth, Mode=OneWay}" Height="{x:Bind ViewModel.StyleManager.Tiles.BoardTileHeight, Mode=OneWay}">
        <Border.Background>
            <SolidColorBrush Color="{ThemeResource SystemAccentColor}" />
        </Border.Background>
        <RelativePanel Margin="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <TextBlock x:Name="ShortName" Foreground="White" FontWeight="SemiBold" RelativePanel.AlignRightWithPanel="True" Margin="0, 0, 8, 0" FontSize="{x:Bind ViewModel.StyleManager.Tiles.BoardTileBoardFontSize, Mode=OneWay}" Text="{x:Bind ViewModel.ShortName, Converter={StaticResource ShortNameConverter}, Mode=OneWay}" />
            <Image x:Name="Logo" Width="{x:Bind ViewModel.StyleManager.Tiles.BoardTileEngineLogoSize, Mode=OneWay}" Height="{x:Bind ViewModel.StyleManager.Tiles.BoardTileEngineLogoSize, Mode=OneWay}" Stretch="Uniform" Source="{x:Bind ViewModel.ResourceLogo, Mode=OneWay}" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignVerticalCenterWith="ShortName" Opacity="0.5" />
            <TextBlock x:Name="EngineName" Foreground="White" RelativePanel.AlignVerticalCenterWith="ShortName" RelativePanel.RightOf="Logo" Opacity="0.5" FontSize="{x:Bind ViewModel.StyleManager.Tiles.BoardTileEngineNameFontSize, Mode=OneWay}" Text="{x:Bind ViewModel.Resource, Mode=OneWay}" Visibility="{x:Bind ViewModel.StyleManager.Tiles.BoardTileEngineNameVisibility, Mode=OneWay}" />
            <TextBlock x:Name="Desc" Foreground="White" RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" TextWrapping="WrapWholeWords" FontSize="{x:Bind ViewModel.StyleManager.Tiles.BoardTileDescFontSize, Mode=OneWay}" Margin="4, 0, 4, 0" HorizontalAlignment="Stretch" TextAlignment="Left" Text="{x:Bind ViewModel.DisplayName, Mode=OneWay}" MaxLines="3"/>
        </RelativePanel>
    </Border>
</UserControl>
